// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// 导入全局样式
import './assets/css/global.css'
import less from 'less';
// 引入饿了么样式组件
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
// 配置请求根路径
//nprogress依赖
import Nprogress  from 'nprogress'
//nprogress依赖的样式
import 'nprogress/nprogress.css'
axios.defaults.baseURL='https://www.liulongbin.top:8888/api/private/v1/'
//resquest进度条中显示进度条 Nprogress.start();
axios.interceptors.request.use(config=>{
  Nprogress.start();
  config.headers.Authorization=window.sessionStorage.getItem('token');
  console.log(config);
  //在最后必须return config
  return config
})
//response中隐藏进度条 Nprogress.done();
axios.interceptors.response.use(config=>{
  Nprogress.done();
  return config;
})
Vue.prototype.$http=axios

Vue.use(less);
Vue.use(ElementUI)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({

  router,
  render: h=>h(App)
}).$mount('#app')
